{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Falkensee\n",
    "-----------------------\n",
    "This example is a reproduction of the Falkanesee plot found in the vega-lite examples.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "import altair as alt\n",
    "alt.data_transformers.enable('json')\n",
    "\n",
    "source = [\n",
    "      {\"year\": \"1875\", \"population\": 1309},\n",
    "      {\"year\": \"1890\", \"population\": 1558},\n",
    "      {\"year\": \"1910\", \"population\": 4512},\n",
    "      {\"year\": \"1925\", \"population\": 8180},\n",
    "      {\"year\": \"1933\", \"population\": 15915},\n",
    "      {\"year\": \"1939\", \"population\": 24824},\n",
    "      {\"year\": \"1946\", \"population\": 28275},\n",
    "      {\"year\": \"1950\", \"population\": 29189},\n",
    "      {\"year\": \"1964\", \"population\": 29881},\n",
    "      {\"year\": \"1971\", \"population\": 26007},\n",
    "      {\"year\": \"1981\", \"population\": 24029},\n",
    "      {\"year\": \"1985\", \"population\": 23340},\n",
    "      {\"year\": \"1989\", \"population\": 22307},\n",
    "      {\"year\": \"1990\", \"population\": 22087},\n",
    "      {\"year\": \"1991\", \"population\": 22139},\n",
    "      {\"year\": \"1992\", \"population\": 22105},\n",
    "      {\"year\": \"1993\", \"population\": 22242},\n",
    "      {\"year\": \"1994\", \"population\": 22801},\n",
    "      {\"year\": \"1995\", \"population\": 24273},\n",
    "      {\"year\": \"1996\", \"population\": 25640},\n",
    "      {\"year\": \"1997\", \"population\": 27393},\n",
    "      {\"year\": \"1998\", \"population\": 29505},\n",
    "      {\"year\": \"1999\", \"population\": 32124},\n",
    "      {\"year\": \"2000\", \"population\": 33791},\n",
    "      {\"year\": \"2001\", \"population\": 35297},\n",
    "      {\"year\": \"2002\", \"population\": 36179},\n",
    "      {\"year\": \"2003\", \"population\": 36829},\n",
    "      {\"year\": \"2004\", \"population\": 37493},\n",
    "      {\"year\": \"2005\", \"population\": 38376},\n",
    "      {\"year\": \"2006\", \"population\": 39008},\n",
    "      {\"year\": \"2007\", \"population\": 39366},\n",
    "      {\"year\": \"2008\", \"population\": 39821},\n",
    "      {\"year\": \"2009\", \"population\": 40179},\n",
    "      {\"year\": \"2010\", \"population\": 40511},\n",
    "      {\"year\": \"2011\", \"population\": 40465},\n",
    "      {\"year\": \"2012\", \"population\": 40905},\n",
    "      {\"year\": \"2013\", \"population\": 41258},\n",
    "      {\"year\": \"2014\", \"population\": 41777}\n",
    "    ]\n",
    "\n",
    "source2 = [{\n",
    "            \"start\": \"1933\",\n",
    "            \"end\": \"1945\",\n",
    "            \"event\": \"Nazi Rule\"\n",
    "          },\n",
    "          {\n",
    "            \"start\": \"1948\",\n",
    "            \"end\": \"1989\",\n",
    "            \"event\": \"GDR (East Germany)\"\n",
    "          }]\n",
    "\n",
    "\n",
    "source = alt.pd.DataFrame(source)\n",
    "source2 = alt.pd.DataFrame(source2)\n",
    "\n",
    "\n",
    "line = alt.Chart(source).mark_line(color='#333').encode(\n",
    "    alt.X('year:T', axis=alt.Axis(format='%Y')),\n",
    "    y='population'\n",
    ").properties(\n",
    "    width=600,\n",
    "    height=400\n",
    ")\n",
    "\n",
    "point = line.mark_point(color='#333')\n",
    "\n",
    "rect = alt.Chart(source2).mark_rect().encode(\n",
    "    x='start:T',\n",
    "    x2='end:T',\n",
    "    color='event:N'\n",
    ")\n",
    "\n",
    "rect + line + point\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "env": {},
   "interrupt_mode": "signal",
   "language": "python",
   "metadata": {},
   "name": "python3"
  },
  "language": "python"
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
